//测试笛卡尔积 [[14,15],[16],[18,19]]
const arr = [[14,15],[16],[18,19]]
console.log([1,2].flat())

function dikaer(arr) {
  return arr.reduce(
    (a, b) =>
    a.flatMap(x=>b.map(y=>[x,y].flat()))
  )
}

function cartesian(arr) {
  return arr.reduce(
    (a, b) =>{
      let result = a.flatMap(d => b.map(e => [d, e].flat()))
      return result;
    }

  )
}
const result  = cartesian(arr)
console.log(result)